/**
 * @USER: Administrator
 * @DATE: 2024/9/19 下午7:20
 * @VERSION: 1.0.0
 */
public class LC2414 {
    public static void main(String[] args) {
        LC2414 lc2414 = new LC2414();
        System.out.println(lc2414.longestContinuousSubstring("abacaba"));
    }

    public int longestContinuousSubstring(String s) {
        int result = 1;
        int max = 1;
        for (int i = 1; i < s.length(); i++) {
            if (s.charAt(i) - s.charAt(i - 1) == 1) {
                result++;
            }else {
                result = 1;
            }

            if (max < result) {
                max = result;
            }
        }
        return max;
    }

}
